7 #include <AppleEvents.h>
8 #include <StandardFile.h>
10 #if defined(powerc) || defined (__powerc)
11 #pragma options align=mac68k
16 FSSpec spec
; // designates file on disk
17 long key
; // reserved for future expansion
19 char tree
; // 0 for absolute, 1 for project, 2 for system
20 Boolean found
; // FALSE if file couldn't be located; if so, all other info is moot
22 OSType type
; // file type of found file
23 OSType crtr
; // signature of found file's creator
25 short spare0
; // reserved for future expansion
43 // masks for the "flags" argument to new-convention interfaces
45 #define xfWindowOpen 0x00000001
46 #define xfWindowChangeable 0x00000002
47 #define xfHasSelection 0x00000004
48 #define xfUseDefaults 0x00000008
49 #define xfIsBBEditLite 0x00000040
50 #define xfIsBBEditDemo 0x00000080
70 #define kCurrentExternalVersion 5 // current version of callbacks
72 // Universal callback interfaces
74 #if USESROUTINEDESCRIPTORS
76 #define ExtensionUPPInfo (kPascalStackBased \
77 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ExternalCallbackBlock *))) \
78 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowPtr))))
80 #define NewExtensionUPPInfo (kPascalStackBased \
81 | RESULT_SIZE(SIZE_CODE(sizeof(OSErr))) \
82 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ExternalCallbackBlock *))) \
83 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowPtr))) \
84 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))) \
85 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(AppleEvent *))) \
86 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(AppleEvent *))))
88 #define GetWindowContentsUPPInfo (kPascalStackBased \
89 | RESULT_SIZE(SIZE_CODE(sizeof(Handle))) \
90 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))))
92 #define GetSelectionUPPInfo (kPascalStackBased \
93 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long *))) \
94 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long *))) \
95 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long *))))
97 #define SetSelectionUPPInfo (kPascalStackBased \
98 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))) \
99 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
100 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))))
102 #define GetDocInfoUPPInfo (kPascalStackBased \
103 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))) \
104 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(unsigned char *))) \
105 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short *))) \
106 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long *))))
108 #define GetModDateUPPInfo (kPascalStackBased \
109 | RESULT_SIZE(SIZE_CODE(sizeof(long))) \
110 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))))
112 #define CopyUPPInfo (kPascalStackBased \
113 | RESULT_SIZE(SIZE_CODE(sizeof(Handle))))
115 #define PasteUPPInfo (kPascalStackBased \
116 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Handle))))
118 #define GetLastLineUPPInfo (kPascalStackBased | RESULT_SIZE(SIZE_CODE(sizeof(long))))
120 #define GetLineNumberUPPInfo (kPascalStackBased \
121 | RESULT_SIZE(SIZE_CODE(sizeof(long))) \
122 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
124 #define GetLineStartUPPInfo (kPascalStackBased \
125 | RESULT_SIZE(SIZE_CODE(sizeof(long))) \
126 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
128 #define GetLineEndUPPInfo (kPascalStackBased \
129 | RESULT_SIZE(SIZE_CODE(sizeof(long))) \
130 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
132 #define GetLinePosUPPInfo (kPascalStackBased \
133 | RESULT_SIZE(SIZE_CODE(sizeof(long))) \
134 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
136 #define InsertUPPInfo (kPascalStackBased \
137 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *))) \
138 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))))
140 #define DeleteUPPInfo (kPascalStackBased)
142 #define SetWindowContentsUPPInfo (kPascalStackBased \
143 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))) \
144 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle))))
146 #define ContentsChangedUPPInfo (kPascalStackBased \
147 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(WindowPtr))))
149 #define GetFileTextUPPInfo (kPascalStackBased \
150 | RESULT_SIZE(SIZE_CODE(sizeof(Handle))) \
151 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short))) \
152 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
153 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(unsigned char *))) \
154 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Boolean *))))
156 #define GetFolderUPPInfo (kPascalStackBased \
157 | RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
158 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(unsigned char *))) \
159 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short *))) \
160 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long *))))
162 #define OpenSeveralUPPInfo (kPascalStackBased \
163 | RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
164 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Boolean))) \
165 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short *))) \
166 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(StandardFileReply ***))))
168 #define CenterDialogUPPInfo (kPascalStackBased \
169 | RESULT_SIZE(SIZE_CODE(sizeof(DialogPtr))) \
170 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short))))
172 #define StandardFilterUPPInfo uppModalFilterProcInfo
174 #define FrameDialogItemUPPInfo uppUserItemProcInfo
176 #define NewDocumentUPPInfo (kPascalStackBased \
177 | RESULT_SIZE(SIZE_CODE(sizeof(WindowPtr))))
179 #define OpenDocumentUPPInfo (kPascalStackBased \
180 | RESULT_SIZE(SIZE_CODE(sizeof(WindowPtr))))
182 #define AllocateUPPInfo (kPascalStackBased \
183 | RESULT_SIZE(SIZE_CODE(sizeof(Handle))) \
184 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))) \
185 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Boolean))))
187 #define FindPatternUPPInfo (kPascalStackBased \
188 | RESULT_SIZE(SIZE_CODE(sizeof(long))) \
189 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(char *))) \
190 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
191 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))) \
192 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(char *))) \
193 | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long))) \
194 | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(Boolean))))
196 #define ReportOSErrorUPPInfo (kPascalStackBased)
198 #define GetPreferenceUPPInfo (kPascalStackBased \
199 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType))) \
200 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short))) \
201 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) \
202 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short *))))
204 #define SetPreferenceUPPInfo (kPascalStackBased \
205 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(ResType))) \
206 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short))) \
207 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(void *))) \
208 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short *))))
210 #define StartProgressUPPInfo (kPascalStackBased \
211 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(unsigned char *))) \
212 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
213 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Boolean))))
215 #define DoProgressUPPInfo (kPascalStackBased \
216 | RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
217 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
219 #define DoneProgressUPPInfo (kPascalStackBased)
221 #define GetProjectListUPPInfo (kPascalStackBased \
222 | RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
223 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))) \
224 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short *))) \
225 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short *))) \
226 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(ProjectEntry***))))
228 #define ProjectTextListUPPInfo (kPascalStackBased \
229 | RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
230 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))) \
231 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Handle *))))
233 #define PresetUndoUPPInfo (kPascalStackBased \
234 | RESULT_SIZE(SIZE_CODE(sizeof(Boolean))))
236 #define SetUndoUPPInfo (kPascalStackBased)
238 #define OpenFileUPPInfo (kPascalStackBased \
239 | RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
240 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FSSpec *))) \
241 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(WindowPtr *))))
243 #define PrepareUndoUPPInfo (kPascalStackBased \
244 | RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
245 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))) \
246 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long))) \
247 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long))) \
248 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long))))
250 #define CommitUndoUPPInfo (kPascalStackBased \
251 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long))))
253 #define CreateResultsUPPInfo (kPascalStackBased \
254 | RESULT_SIZE(SIZE_CODE(sizeof(Boolean))) \
255 | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(unsigned char *))) \
256 | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short))) \
257 | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(Handle))) \
258 | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(WindowPtr *))))
260 typedef UniversalProcPtr GetWindowContentsProc
;
261 typedef UniversalProcPtr GetSelectionProc
;
262 typedef UniversalProcPtr SetSelectionProc
;
263 typedef UniversalProcPtr GetDocInfoProc
;
264 typedef UniversalProcPtr GetModDateProc
;
265 typedef UniversalProcPtr CopyProc
;
266 typedef UniversalProcPtr PasteProc
;
268 typedef UniversalProcPtr GetLastLineProc
;
269 typedef UniversalProcPtr GetLineNumberProc
;
270 typedef UniversalProcPtr GetLineStartProc
;
271 typedef UniversalProcPtr GetLineEndProc
;
272 typedef UniversalProcPtr GetLinePosProc
;
274 typedef UniversalProcPtr InsertProc
;
275 typedef UniversalProcPtr DeleteProc
;
277 typedef UniversalProcPtr SetWindowContentsProc
;
278 typedef UniversalProcPtr ContentsChangedProc
;
280 typedef UniversalProcPtr GetFileTextProc
;
282 typedef UniversalProcPtr GetFolderProc
;
283 typedef UniversalProcPtr OpenSeveralProc
;
285 typedef UniversalProcPtr CenterDialogProc
;
286 typedef UniversalProcPtr StandardFilterProc
;
287 typedef UniversalProcPtr FrameDialogItemProc
;
289 typedef UniversalProcPtr NewDocumentProc
;
290 typedef UniversalProcPtr OpenDocumentProc
;
292 typedef UniversalProcPtr AllocateProc
;
293 typedef UniversalProcPtr FindPatternProc
;
295 typedef UniversalProcPtr ReportOSErrorProc
;
297 typedef UniversalProcPtr GetPreferenceProc
;
298 typedef UniversalProcPtr SetPreferenceProc
;
300 typedef UniversalProcPtr StartProgressProc
;
301 typedef UniversalProcPtr DoProgressProc
;
302 typedef UniversalProcPtr DoneProgressProc
;
304 typedef UniversalProcPtr GetProjectListProc
;
305 typedef UniversalProcPtr ProjectTextListProc
;
307 typedef UniversalProcPtr PresetUndoProc
;
308 typedef UniversalProcPtr SetUndoProc
;
310 typedef UniversalProcPtr OpenFileProc
;
312 typedef UniversalProcPtr PrepareUndoProc
;
313 typedef UniversalProcPtr CommitUndoProc
;
315 typedef UniversalProcPtr CreateResultsProc
;
317 #define CallGetWindowContents(proc, w) \
318 (Handle)(CallUniversalProc(proc, GetWindowContentsUPPInfo, (w)))
320 #define CallGetSelection(proc, selStart, selEnd, firstChar) \
321 (CallUniversalProc(proc, GetSelectionUPPInfo, (selStart), (selEnd), (firstChar)))
323 #define CallSetSelection(proc, selStart, selEnd, firstChar) \
324 (CallUniversalProc(proc, SetSelectionUPPInfo, (selStart), (selEnd), (firstChar)))
326 #define CallGetDocInfo(proc, w, name, vRefNum, dirID) \
327 (CallUniversalProc(proc, GetDocInfoUPPInfo, (w), (name), (vRefNum), (dirID)))
329 #define CallGetModDate(proc, w) \
330 (CallUniversalProc(proc, GetModDateUPPInfo, (w)))
332 #define CallCopy(proc) \
333 (Handle)(CallUniversalProc(proc, CopyUPPInfo))
335 #define CallPaste(proc, h) \
336 (CallUniversalProc(proc, PasteUPPInfo, (h)))
338 #define CallGetLastLine(proc) \
339 (CallUniversalProc(proc, GetLastLineUPPInfo))
341 #define CallGetLineNumber(proc, sel) \
342 (CallUniversalProc(proc, GetLineNumberUPPInfo, (sel)))
344 #define CallGetLineStart(proc, sel) \
345 (CallUniversalProc(proc, GetLineStartUPPInfo, (sel)))
347 #define CallGetLineEnd(proc, sel) \
348 (CallUniversalProc(proc, GetLineEndUPPInfo, (sel)))
350 #define CallGetLinePos(proc, sel) \
351 (CallUniversalProc(proc, GetLinePosUPPInfo, (sel)))
353 #define CallInsert(proc, text, len) \
354 (CallUniversalProc(proc, InsertUPPInfo, (text), (len)))
356 #define CallDelete(proc) \
357 (CallUniversalProc(proc, DeleteUPPInfo))
359 #define CallSetWindowContents(proc, w, h) \
360 (CallUniversalProc(proc, SetWindowContentsUPPInfo, (w), (h)))
362 #define CallContentsChanged(proc, w) \
363 (CallUniversalProc(proc, ContentsChangedUPPInfo, (w)))
365 #define CallGetFileText(proc, vRefNum, dirID, name, canDispose) \
366 (Handle)(CallUniversalProc(proc, GetFileTextUPPInfo, (vRefNum), (dirID), (name), (canDispose)))
368 #define CallGetFolder(proc, prompt, vRefNum, dirID) \
369 (Boolean)(CallUniversalProc(proc, GetFolderUPPInfo, (prompt), (vRefNum), (dirID)))
371 #define CallOpenSeveral(proc, sort, file_count, files) \
372 (Boolean)(CallUniversalProc(proc, OpenSeveralUPPInfo, (sort), (file_count), (files)))
374 #define CallCenterDialog(proc, dialogID) \
375 (DialogPtr)(CallUniversalProc(proc, CenterDialogUPPInfo, (dialogID)))
377 #define CallStandardFilter(proc, d, event, item) \
378 CallModalFilterProc(proc, (d), (event), (item))
380 #define CallFrameDialogItem(proc, d, item) \
381 CallUserItemProc(proc, (d), (item))
383 #define CallNewDocument(proc) \
384 (WindowPtr)(CallUniversalProc(proc, NewDocumentUPPInfo))
386 #define CallOpenDocument(proc) \
387 (WindowPtr)(CallUniversalProc(proc, OpenDocumentUPPInfo))
389 #define CallAllocate(proc, size, clear) \
390 (Handle)(CallUniversalProc(proc, AllocateUPPInfo, (size), (clear)))
392 #define CallFindPattern(proc, text, text_len, text_offset, pat, pat_len, case_sens) \
393 (CallUniversalProc(proc, FindPatternUPPInfo, (text), (text_len), (text_offset), \
394 (pat), (pat_len), (case_sens)))
396 #define CallReportOSError(proc, code) \
397 (CallUniversalProc(proc, ReportOSErrorUPPInfo, (code)))
399 #define CallGetPreference(proc, prefType, req_len, buffer, act_len) \
400 (CallUniversalProc(proc, GetPreferenceUPPInfo, (prefType), (req_len), (buffer), (act_len)))
402 #define CallSetPreference(proc, prefType, req_len, buffer, act_len) \
403 (CallUniversalProc(proc, SetPreferenceUPPInfo, (prefType), (req_len), (buffer), (act_len)))
405 #define CallStartProgress(proc, str, total, cancel_allowed) \
406 (CallUniversalProc(proc, StartProgressUPPInfo, (str), (total), (cancel_allowed)))
408 #define CallDoProgress(proc, done) \
409 (Boolean)(CallUniversalProc(proc, DoProgressUPPInfo, (done)))
411 #define CallDoneProgress(proc) \
412 (CallUniversalProc(proc, DoneProgressUPPInfo))
414 #define CallGetProjectList(proc, spec, kind, count, entries) \
415 (Boolean)(CallUniversalProc(proc, GetProjectListUPPInfo, (spec), (kind), (count), (entries)))
417 #define CallProjectTextList(proc, spec, text) \
418 (Boolean)(CallUniversalProc(proc, ProjectTextListUPPInfo, (spec), (text)))
420 #define CallPresetUndo(proc) \
421 (Boolean)(CallUniversalProc(proc, PresetUndoUPPInfo))
423 #define CallSetUndo(proc) \
424 (CallUniversalProc(proc, SetUndoUPPInfo))
426 #define CallOpenFile(proc, spec, w) \
427 (Boolean)(CallUniversalProc(proc, OpenFileUPPInfo, (spec), (w)))
429 #define CallPrepareUndo(proc, undo_start, undo_end, sel_start, sel_end) \
430 (Boolean)(CallUniversalProc(proc, PrepareUndoUPPInfo, (undo_start), (undo_end), \
431 (sel_start), (sel_end)))
433 #define CallCommitUndo(proc, new_end) \
434 (CallUniversalProc(proc, CommitUndoUPPInfo, (new_end)))
436 #define CallCreateResults(proc, title, count, results, w) \
437 (Boolean)(CallUniversalProc(proc, CreateResultsUPPInfo, (title), (count), (results), (w)))
441 typedef pascal Handle (*GetWindowContentsProc
)(WindowPtr w
);
442 typedef pascal void (*GetSelectionProc
)(long *selStart
, long *selEnd
, long *firstChar
);
443 typedef pascal void (*SetSelectionProc
)(long selStart
, long selEnd
, long firstChar
);
444 typedef pascal void (*GetDocInfoProc
)(WindowPtr w
, Str255 fName
, short *vRefNum
, long *dirID
);
445 typedef pascal long (*GetModDateProc
)(WindowPtr w
);
446 typedef pascal Handle (*CopyProc
)(void);
447 typedef pascal void (*PasteProc
)(Handle pasteText
);
449 typedef pascal long (*GetLastLineProc
)(void);
450 typedef pascal long (*GetLineNumberProc
)(long selection
);
451 typedef pascal long (*GetLineStartProc
)(long selection
);
452 typedef pascal long (*GetLineEndProc
)(long selection
);
453 typedef pascal long (*GetLinePosProc
)(long line
);
455 typedef pascal void (*InsertProc
)(char *text
, long len
);
456 typedef pascal void (*DeleteProc
)(void);
458 typedef pascal void (*SetWindowContentsProc
)(WindowPtr w
, Handle h
);
459 typedef pascal void (*ContentsChangedProc
)(WindowPtr w
);
461 typedef pascal Handle (*GetFileTextProc
)(short vRefNum
, long dirID
, Str255 fName
, Boolean
*canDispose
);
463 typedef pascal Boolean (*GetFolderProc
)(Str255 prompt
, short *vRefNum
, long *dirID
);
464 typedef pascal Boolean (*OpenSeveralProc
)(Boolean sort
, short *file_count
, StandardFileReply
***files
);
466 typedef pascal DialogPtr (*CenterDialogProc
)(short dialogID
);
467 typedef pascal Boolean (*StandardFilterProc
)(DialogPtr d
, EventRecord
*event
, short *item
);
468 typedef pascal void (*FrameDialogItemProc
)(DialogPtr d
, short item
);
470 typedef pascal WindowPtr (*NewDocumentProc
)(void);
471 typedef pascal WindowPtr (*OpenDocumentProc
)(void);
473 typedef pascal Handle (*AllocateProc
)(long size
, Boolean clear
);
474 typedef pascal long (*FindPatternProc
)(char *text
, long text_len
, long text_offset
,
475 char *pat
, long pat_len
,
476 Boolean case_sensitive
);
478 typedef pascal void (*ReportOSErrorProc
)(short code
);
480 typedef pascal void (*GetPreferenceProc
)(ResType prefType
, short req_len
, void *buffer
, short *act_len
);
481 typedef pascal void (*SetPreferenceProc
)(ResType prefType
, short req_len
, void *buffer
, short *act_len
);
483 typedef pascal void (*StartProgressProc
)(Str255 str
, long total
, Boolean cancel_allowed
);
484 typedef pascal Boolean (*DoProgressProc
)(long done
);
485 typedef pascal void (*DoneProgressProc
)(void);
487 typedef pascal Boolean (*GetProjectListProc
)(FSSpec
*spec
, short *kind
, short *count
, ProjectEntry
***entries
);
488 typedef pascal Boolean (*ProjectTextListProc
)(FSSpec
*spec
, Handle
*text
);
490 typedef pascal Boolean (*PresetUndoProc
)(void);
491 typedef pascal void (*SetUndoProc
)(void);
493 typedef pascal Boolean (*OpenFileProc
)(FSSpec
*spec
, WindowPtr
*w
);
495 typedef pascal Boolean (*PrepareUndoProc
)(long undo_start
, long undo_end
,
496 long sel_start
, long sel_end
);
497 typedef pascal void (*CommitUndoProc
)(long new_end
);
499 typedef pascal Boolean (*CreateResultsProc
)(Str255 title
, short count
, Handle results
, WindowPtr
*w
);
501 #define CallGetWindowContents(proc, w) \
504 #define CallGetSelection(proc, selStart, selEnd, firstChar) \
505 ((proc))((selStart), (selEnd), (firstChar))
507 #define CallSetSelection(proc, selStart, selEnd, firstChar) \
508 ((proc))((selStart), (selEnd), (firstChar))
510 #define CallGetDocInfo(proc, w, name, vRefNum, dirID) \
511 ((proc))((w), (name), (vRefNum), (dirID))
513 #define CallGetModDate(proc, w) \
516 #define CallCopy(proc) \
519 #define CallPaste(proc, h) \
522 #define CallGetLastLine(proc) \
525 #define CallGetLineNumber(proc, sel) \
528 #define CallGetLineStart(proc, sel) \
531 #define CallGetLineEnd(proc, sel) \
534 #define CallGetLinePos(proc, sel) \
537 #define CallInsert(proc, text, len) \
538 ((proc))((text), (len))
540 #define CallDelete(proc) \
543 #define CallSetWindowContents(proc, w, h) \
546 #define CallContentsChanged(proc, w) \
549 #define CallGetFileText(proc, vRefNum, dirID, name, canDispose) \
550 ((proc))((vRefNum), (dirID), (name), (canDispose))
552 #define CallGetFolder(proc, prompt, vRefNum, dirID) \
553 ((proc))((prompt), (vRefNum), (dirID))
555 #define CallOpenSeveral(proc, sort, file_count, files) \
556 ((proc))((sort), (file_count), (files))
558 #define CallCenterDialog(proc, dialogID) \
561 #define CallStandardFilter(proc, d, event, item) \
562 ((proc))((d), (event), (item))
564 #define CallFrameDialogItem(proc, d, item) \
565 ((proc))((d), (item))
567 #define CallNewDocument(proc) \
570 #define CallOpenDocument(proc) \
573 #define CallAllocate(proc, size, clear) \
574 ((proc))((size), (clear))
576 #define CallFindPattern(proc, text, text_len, text_offset, pat, pat_len, case_sens) \
577 ((proc))((text), (text_len), (text_offset), (pat), (pat_len), (case_sens))
579 #define CallReportOSError(proc, code) \
582 #define CallGetPreference(proc, prefType, req_len, buffer, act_len) \
583 ((proc))((prefType), (req_len), (buffer), (act_len))
585 #define CallSetPreference(proc, prefType, req_len, buffer, act_len) \
586 ((proc))((prefType), (req_len), (buffer), (act_len))
588 #define CallStartProgress(proc, str, total, cancel_allowed) \
589 ((proc))((str), (total), (cancel_allowed))
591 #define CallDoProgress(proc, done) \
594 #define CallDoneProgress(proc) \
597 #define CallGetProjectList(proc, spec, kind, count, entries) \
598 ((proc))((spec), (kind), (count), (entries))
600 #define CallProjectTextList(proc, spec, text) \
601 ((proc))((spec), (text))
603 #define CallPresetUndo(proc) \
606 #define CallSetUndo(proc) \
609 #define CallOpenFile(proc, spec, w) \
610 ((proc))((spec), (w))
612 #define CallPrepareUndo(proc, undo_start, undo_end, sel_start, sel_end) \
613 ((proc))((undo_start), (undo_end), (sel_start), (sel_end))
615 #define CallCommitUndo(proc, new_end) \
618 #define CallCreateResults(proc, title, count, results, w) \
619 ((proc))((title), (count), (results), (w))
628 // version 1 callbacks
630 GetWindowContentsProc GetWindowContents
;
631 GetSelectionProc GetSelection
;
632 SetSelectionProc SetSelection
;
633 GetDocInfoProc GetDocInfo
;
634 GetModDateProc GetModDate
;
638 // version 2 callbacks
640 /* Text-Editing stuff */
641 GetLastLineProc GetLastLine
;
642 GetLineNumberProc GetLineNumber
;
643 GetLineStartProc GetLineStart
;
644 GetLineEndProc GetLineEnd
;
645 GetLinePosProc GetLinePos
;
650 /* Getting and Setting window text */
651 SetWindowContentsProc SetWindowContents
;
652 ContentsChangedProc ContentsChanged
;
654 /* Reading file text */
655 GetFileTextProc GetFileText
;
657 /* Direct user-interface calls */
658 GetFolderProc GetFolder
;
659 OpenSeveralProc OpenSeveral
;
661 CenterDialogProc CenterDialog
;
662 StandardFilterProc StandardFilter
;
663 FrameDialogItemProc FrameDialogItem
;
665 NewDocumentProc NewDocument
;
666 OpenDocumentProc OpenDocument
;
668 /* Utility Routines */
669 AllocateProc Allocate
;
670 FindPatternProc FindPattern
;
672 ReportOSErrorProc ReportOSError
;
674 /* Preference routines */
675 GetPreferenceProc GetPreference
;
676 SetPreferenceProc SetPreference
;
678 /* Progress routines */
679 StartProgressProc StartProgress
;
680 DoProgressProc DoProgress
;
681 DoneProgressProc DoneProgress
;
683 // Version 3 callbacks
684 GetProjectListProc GetProjectList
;
685 ProjectTextListProc ProjectTextList
;
687 // version 4 callbacks
689 PresetUndoProc PresetUndo
;
692 OpenFileProc OpenFile
;
694 // version 5 callbacks
696 PrepareUndoProc PrepareUndo
;
697 CommitUndoProc CommitUndo
;
699 CreateResultsProc CreateResults
;
701 } ExternalCallbackBlock
;
703 #if defined(powerc) || defined (__powerc)
704 #pragma options align=reset
708 'main' for a BBXT is declared:
710 pascal void main(ExternalCallbackBlock *callbacks, WindowPtr w); [C]
712 The 'new' calling convention, which passes more information
713 and allows scriptability, is this:
715 pascal OSErr main(ExternalCallbackBlock *callbacks, WindowPtr w, long flags, AppleEvent *event, AppleEvent *reply);